//符合AMD规范的写在前面
define(['jquery','underscore','handlebars','app/submitData'],function ($,_,Handlebars,submitData) {

    function MySitePage() {

    }

    MySitePage.prototype._init = function () {
        var _this = this;
        _this.template();
    };

    MySitePage.prototype.template=function(){
        var _this = this;
        var source=$("#entryTemplate").html();
        var tempGo=Handlebars.compile(source);

        var context ={
            people: [
                {firstName: "Yehuda", lastName: "Katz"},
                {firstName: "Carl", lastName: "Lerche"},
                {firstName: "Alan", lastName: "Johnson"}
            ]
        };

        Handlebars.registerHelper('list',function(items,options){
            var out="<ul>";
            for(var i= 0,len=items.length;i<len;i++){
                out=out+"<li>"+options.fn(items[i])+"</li>";
            }
            return out+="</ul>";
        });

        var html=tempGo(context);
        $("#res").html(html);
    };



    MySitePage.prototype.render = function () {
        this._init();
    };

    return MySitePage;
});